import { Controller,Get, Req, Res } from '@nestjs/common';
import { CaptchaService } from './captcha.service';

@Controller({
  path:'captcha',
  version:'1'
})
export class CaptchaController {
  constructor(private readonly captchaService: CaptchaService) {}
  @Get()
  capcha(@Req() req ,@Res() res) {
    const svg = this.captchaService.captcha()
    const {data,text} = svg
    req.session.code = text
    res.type('svg')
    res.status(200).send(data);
  }
}
